package com.itheima.pinda.authority.feign;

import com.itheima.pinda.authority.entity.common.Area;
import com.itheima.pinda.base.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(name = "pd-aggregation",path = "area")
public interface AreaFeign {

    @GetMapping("/findById/{id}")
    public Area getArea(@PathVariable(value = "id")Long id);

    @PostMapping("/addArea")
    public Boolean addArea(@RequestBody Area area);

    @DeleteMapping("/deleteById/{id}")
    public Boolean deleteArea(@PathVariable(value = "id") String id);

    @PutMapping("/updateArea")
    public Boolean updateArea(@RequestBody Area area);

    @GetMapping({"/code/{code}"})
    R<Area> getByCode(@PathVariable String code);

    @GetMapping
    R<List<Area>> findAll(@RequestParam(value = "parentId",required = false) Long parentId, @RequestParam(value = "ids",required = false) List<Long> ids);
}
